<!--
  SMIL3 5.4.3, "Resetting element state" has:

    Any instance times associated with past Event-values, Repeat-values,
    Accesskey-values or added via DOM method calls are removed from the
    dependent begin and end instance times lists. In effect, all events and DOM
    methods calls in the past are cleared. This does not apply to an instance
    time that defines the begin of the current interval.

  In this test we have the following scenario:

    <set begin="1s" end="2s" dur="1s" ... />

  giving us:

    |...|
    1   2

  Then at t=1.5s we have the following DOM calls

    anim.beginElementAt(1.5);
    anim.endElementAt(2);

  potentially giving us:

    |...|  | |
      ^  
    1   2  3 3.5

  At t=2s we'll go to look for the next interval and construct one from 3s-3.5s.
  We should apply restart behaviour at t=3s meaning we'll reset instance times
  generated by DOM calls in the past however we'll keep the begin instance time
  at 3s since it defines the beginning of the (now) current interval.  Sticking
  to the letter of the spec quoted above however, we'll end up clearing the end
  instance at 3.5s. Yet in this case we should use the active end (t=4s) since
  there's no end attribute specified.
 -->
<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  class="reftest-wait"
  onload="addInstanceTimes()">
  <script type="text/ecmascript"><![CDATA[
    function addInstanceTimes() {
      var svg = document.documentElement;
      svg.pauseAnimations();
      svg.setCurrentTime(1.5);
      var anim = document.getElementById('anim');
      anim.beginElementAt(1.5);
      anim.endElementAt(2);
      setTimeAndSnapshot(3.7, true);
    }
  ]]></script>
  <script xlink:href="../smil-util.js" type="text/javascript"/>
  <rect width="100" height="100" fill="red">
    <set attributeName="fill" attributeType="CSS"
      to="green" begin="1s" dur="1s" fill="remove" id="anim"/>
  </rect>
</svg>
